#include "Scene.h"

Scene::Scene (SDL_Surface *sf): 
  screen(sf), fps(0), frames(0)
{
  obj = new Object3D("data/monolow.orj");
  cout << "Faces: " << obj->numberOfFaces() << " Vertices: " << obj->numberOfVertices() << endl;
  
  current_time = SDL_GetTicks();
}
 
Scene::~Scene ()
{
  delete obj;
}

GLuint
Scene::genList ()
{
  // Create the display list.
  // Render the object.
}

void
Scene::draw ()
{
  frames++;
  // How many frames per second?
  if (SDL_GetTicks() - current_time > 1000) {
    current_time = SDL_GetTicks();
    fps = frames;
    frames = 0;
    cout << "FPS: " << fps << endl;
  }

  // Clear buffers.
  glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
  
  // Render the object.
  obj->draw();

  // Swap buffers.
  SDL_GL_SwapBuffers();
}
